package SuanFa;

public class testZheBan {
    public static void main(String[] args) {
        int[] arr = {1,3,6,9,12,23,33,44,45,67,78,98,100,111,123,1234,2345,9999,11111,12345,666666,900000};
        System.out.println(getNumber(arr,3));
    }
    public static int getNumber(int[] list,int x){
        int op=0;
        int ed=list.length-1;
        int mid=-1;
        while (op<=ed){
            mid=(op+ed)/2;
            if(list[mid]>x){
                ed=mid-1;
            }
            if (list[mid]<x) {
                op = mid + 1;
            }
            if (list[mid]==x){
                break;
            }
        }
        return mid;
    }
}
